package cn.com.demo.microservice.anquan.mapper;

import cn.com.demo.microservice.entity.AqAccount;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

public class AqAccountSqlProvider {

    public String insertSelective(AqAccount record) {
        BEGIN();
        INSERT_INTO("aq_account");
        
        if (record.getAccId() != null) {
            VALUES("acc_id", "#{accId,jdbcType=INTEGER}");
        }
        
        if (record.getAccCode() != null) {
            VALUES("acc_code", "#{accCode,jdbcType=VARCHAR}");
        }
        
        if (record.getAccPassword() != null) {
            VALUES("acc_password", "#{accPassword,jdbcType=VARCHAR}");
        }
        
        if (record.getAccSlat() != null) {
            VALUES("acc_slat", "#{accSlat,jdbcType=VARCHAR}");
        }
        
        if (record.getAccStatus() != null) {
            VALUES("acc_status", "#{accStatus,jdbcType=INTEGER}");
        }
        
        if (record.getAccUrId() != null) {
            VALUES("acc_ur_id", "#{accUrId,jdbcType=INTEGER}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(AqAccount record) {
        BEGIN();
        UPDATE("aq_account");
        
        if (record.getAccCode() != null) {
            SET("acc_code = #{accCode,jdbcType=VARCHAR}");
        }
        
        if (record.getAccPassword() != null) {
            SET("acc_password = #{accPassword,jdbcType=VARCHAR}");
        }
        
        if (record.getAccSlat() != null) {
            SET("acc_slat = #{accSlat,jdbcType=VARCHAR}");
        }
        
        if (record.getAccStatus() != null) {
            SET("acc_status = #{accStatus,jdbcType=INTEGER}");
        }
        
        if (record.getAccUrId() != null) {
            SET("acc_ur_id = #{accUrId,jdbcType=INTEGER}");
        }
        
        WHERE("acc_id = #{accId,jdbcType=INTEGER}");
        
        return SQL();
    }
}